package zuoye05;

public class zuoye3 {
     public static void main(String[] args) {
         String str="dasdsawqeqw";
         int a=2;
         shuchu(str,a);
     }

     public static void shuchu(String str,int a){
   String str1="";
         for(int i=0;i<str.length();i++){
             int count=0;
             for(int j=0;j<str.length();j++) {
                 if (str.charAt(j) == str.charAt(i)) {
                     count++;
                 }

             }
             if(count==a&&str1.indexOf(str.charAt(i))<=0){
                 System.out.print(count+"次"+str.charAt(i)+" ");
                 str1+=str.charAt(i);
             }
         }
     }
}
